package observer0;

/**
 * @author Frank
 * @create 2018-11-16 16:59
 * @desc 描述
 **/
public class CurrentCondituinDisplay implements Observer, Displayment {

    private float temp;
    private float humidity;
    private Subject weatherData;

    public CurrentCondituinDisplay(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    @Override

    public void display() {
        System.out.println("CurrentCondituinDisplay{" +
            "temp=" + temp +
            ", humidity=" + humidity +
            '}');
    }

    @Override
    public void update(float temp, float humidity, float pressure) {
        this.humidity = humidity;
        this.temp = temp;
        display();
    }
}
